/**
 * 系统设置控制器
 */
import $_fn from '~plugins'
export default ['$scope','$rootScope','$location','$ui','http','$state',function($scope,$rootScope,$location,$ui,http,$state) {
    $scope.tabMenu = $_fn.getCurrMenu($location.path())
    console.log($scope.tabMenu)
    $scope.subMenu = $scope.tabMenu.children[1].children
    console.log($scope.subMenu)
    console.log($location.path())
	console.log('系统设置权限设置管理员控制器')
	 //获取数据的函数
	 $scope.params={}
    $scope.getDada = function(page){
      //  $scope.params.pageNum = page
        http.post('queryRoleList.do',$scope.params,function (data) {
            if(data.errcode==1){
            	$scope.dataList=data.data
            	if($scope.dataList.length<1){
            		$scope.isData = true;//暂无数据
            	}
            	$scope.$apply()
            }else{
            	$ui.toast({
					text:data.errmsg,
					type:'warning'
				})
            }
        },function(){
            //报错时
            $scope.isData = true
        })
    }
    $scope.getDada(1)  //初始化数据
	//添加管理员
	$scope.operation = function (path,id,state,name) {
        var _path = path.split('@')
        if(_path[0] == 'link'){
            console.log(path)
            console.log(_path[1])
            $state.go('setup.'+_path[1],{id:id,ids:2,state:state})
        }
        if(_path[0] == 'alert'){
        	console.log(_path[1])
            $ui.modal({content:"<"+_path[1]+" name='"+name+"'id='"+id+"'></"+_path[1]+">"})
        }
    }
	/*$scope.guanLiYuanLieBiao({pageNum:1})*/
}]
